#! /bin/bash

#项目目录
AppDir=/data/vue

# 前往vue项目目录
cd $AppDir
# 删除原本的包
rm -rf dist
# 解压新的包
unzip dist.zip
# 备份当前包
if [ -d "$AppDir/backup" ]; then
    echo "backup file directory is found"
else
    mkdir "$AppDir/backup"
    echo "mkdir backup file directory"
fi
# 取消cp别名 仅此次登录生效
unalias cp
# 备份
cp -f dist.zip "$AppDir/backup/dist-`date '+%Y-%m-%d_%H:%M:%S'`.zip"
